package com.woniu.zsd.user.utils;

import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;
import com.woniu.commons.util.RedisKey;
import com.woniu.commons.util.JwtUtil;

import javax.annotation.Resource;

@Component
public class UserTokenUtil {
    @Resource
    private JwtUtil jwtUtil;
    @Resource
    private StringRedisTemplate stringRedisTemplate;
    public Integer getUserId(String token){
        Integer AdminId = (Integer) jwtUtil.parseToken(stringRedisTemplate.opsForValue().get(RedisKey.USER_REFRESH_TOKEN_KEY(token))).get("id");
        return AdminId;
    }
}
